package com.sanyang.pda.adapter;

import android.widget.CheckBox;
import android.widget.CompoundButton;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.sanyang.pda.bean.HaveTestedBean;
import com.wangshen.base.ui.mvp.base.adapter.BaseAdapter;
import com.wangshen.projectbase.R;

import java.util.List;

public class SampleBackAdapter extends BaseAdapter<HaveTestedBean> {
    public SampleBackAdapter(int layoutResId, @Nullable List<HaveTestedBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, HaveTestedBean item) {
        super.convert(helper, item);
        helper.setText(R.id.tv_batch,item.getBatchNo());
        helper.setText(R.id.tv_quality_order,item.getSamplingResultNo()+"");
        helper.setText(R.id.tv_goods_name,item.getArticleName());
        helper.setText(R.id.tv_standard,item.getSpec());
        helper.setText(R.id.tv_quality_inspection_number,item.getCheckNum()+"");
        helper.setText(R.id.tv_fromPallet,item.getFromPallet());
        helper.setText(R.id.tv_if_qualified,item.getQualifiedStatusCn());
        helper.setText(R.id.tv_samplingNo,item.getSamplingNo());
        CheckBox checkBox=helper.getView(R.id.cb_select);
        checkBox.setChecked(item.isSelect());
        checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                item.setSelect(isChecked);
            }
        });
    }
}
